<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>个人店铺-商品列表</title>
<link href="<?php echo $this->_webroot('/style/jq-ui/jquery-ui-1.8.18.custom.css'); ?>" rel="stylesheet" type="text/css">
<link href="<?php echo $this->_webroot('/style/css.css'); ?>" rel="stylesheet" type="text/css">
<link href="<?php echo $this->_webroot('/style/content.css'); ?>" rel="stylesheet" type="text/css">
<script type="text/javascript" src="<?php echo $this->_webroot('script/jquery-1.7.1.min.js'); ?>"></script>
<script type="text/javascript" src="<?php echo $this->_webroot('script/jquery-ui-1.8.18.custom.min.js'); ?>"></script>
<script type="text/javascript" src="<?php echo $this->_webroot('script/jquery.carouFredSel-5.5.0-packed.js'); ?>"></script>
<script type="text/javascript" src="<?php echo $this->_webroot('script/js.js'); ?>"></script>
<script type="text/javascript" src="<?php echo $this->_webroot('script/content.js'); ?>"></script>

</head>

<body>
<psp:tags     htmlname='shop_topnav'  iconname='shoptopnav' />


<div class="head headpadding">
    <psp:tags     htmlname='shopsearch_default'  iconname='shopsearch_default' />
    <div class="clear"></div>
</div>
<!-- nav_wrap -->
<div class="nav_wrap">
	<div class="nav_logo border_bottom1">
    	<img src="<?php if(!empty($SHOP['shop_template_img'])) {echo $SHOP['shop_template_img'];}else{echo $this->_webroot('photo/company_logo.jpg');}?>"  onerror="this.src='<?php echo $this->_webroot('photo/company_logo.jpg'); ?>'" width="998" height="154" />
    	<div class="nav1_content">
    		<ul class="nav1_ul">
                <psp:tags     htmlname='shopnav_default'  iconname='shopnav' />
            </ul>	
        
    	</div>    
    </div>
    
</div>
<!-- nav_wrap end -->

<div class="container margintop1">

	<!-- main_left -->
	<div id="main_left">
		<psp:tags     htmlname='shopleftmenu_default'  iconname='shopleftmenu_default' />	
        
        <!--  客服中心 -->
		<psp:tags     htmlname='shopservice_default'  iconname='shopservice_default' />
        <!--  客服中心 end -->
        
        <!-- 销量排行 -->
		<psp:tags     htmlname='shopsalesrank_default'  iconname='shopsalesrank_default' />		
        <!-- 销量排行 -->
        <div class="clear"></div>
        
        
    </div>
    <!-- main_left end -->

	<!-- main_right -->
	<div id="main_right">    
   		<!-- 所有商品 -->
		<div class="allgoods_wrap">
            <div class="all_goods_hd">
 <?php
$all_url = 'http://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
if(!strstr($all_url,"?")) {
$all_url = $all_url."?";
}
$all_url = preg_replace("/&down_price=([^&]+)/","",$all_url);
$all_url = preg_replace("/&up_price=([^&]+)/","",$all_url);
$all_url = preg_replace("/&pv=([^&]+)/","",$all_url);
$all_url = preg_replace("/&fpv=([^&]+)/","",$all_url);
$all_url = preg_replace("/&new=([^&]+)/","",$all_url);
?>  			
                <ul class="all_goods_hd_ul">
                	<li><a href="<?php echo $this->_url('shop/products/'.$SHOP['id']);?>" class="allgoods">所有商品</a></li>
                    <li><a href="<?php echo $all_url.'&pv=1';?>" class="popularity">人气</a></li>
                    <li><a href="<?php echo $all_url.'&fpv=1';?>" class="popularity">收藏</a></li>
                    <li><a href="<?php echo $all_url.'&new=1';?>" class="popularity">新品</a></li>
                </ul>
            </div>
            <div class="all_godds_body">
            	<div class="search_conditon">
                	<img src="<?php echo $this->_webroot('images/condition_left.jpg'); ?>" width="5" height="33" class="condition_left" />
                    <form  method="get" action="<?php echo $this->_url('shop/products/'.$SHOP['id'].'/?cat='.$value['id']);?>">					
                    <div class="search_condition_center">
                    	<span>搜索：</span>
					    <input type="text" class="inputtext1" name="k" value="<?php echo $keyworld; ?>" />
                        <span class="price_label">价格：</span>
                        <input type="text" class="inputtext1" name="pr1" value="<?php echo $pr1; ?>" />-<input type="text" class="inputtext1"  name="pr2"  value="<?php echo $pr2; ?>"  />
                        <a href="<?php echo $all_url.'&down_price=1';?>" class="down_arrow"></a>
                    	<a href="<?php echo $all_url.'&up_price=1';?>" class="up_arrow"></a>						
						<input type="hidden"  name="cat" value="<?php echo $cat; ?>"/>
                        <input type="submit" value="" class="submit2" />
                    </div>
                    </form>					
                    <img src="<?php echo $this->_webroot('images/condition_right.gif'); ?>" width="5" height="33" class="condition_right" />
                	<div class="clear"></div>
                </div>
            <input type="hidden" value="<?php echo  $this->controller->my->id;?>" id="shop_user" />
			<input type="hidden" value="<?php echo  $SHOP['id'];?>" id="shop_id" />				
<script language="JavaScript" src="<?php echo $this->_webroot('servtools/ajax_client/ajax.js');?>"></script>
<script language="JavaScript">
	<!--
		function addCart(id) {
			var num = document.getElementById('num'+id);
			var shop_id = document.getElementById('shop_id').value;
			var user_id = document.getElementById('shop_user').value;
			
			var num_reg = /^(\d+)$/;
			if(!num_reg.test(num.value)){
				alert('购买数量格式不正确!');
				return;
			}
			if(num.value=='0'){
				alert('购买数量不能为0！');
				return;
			}

			if (shop_id == user_id){
				alert('自己的商品不能放入购物车');
			}else{
				ajax("<?php echo $this->_url('shop/goodsaddcart');?>","POST","id="+id+"&num="+num.value,function(data){
					if(data == 1) {
						alert("已成功添加到您的购物车！");
					} else if(data == -1) {
						alert("此商品已在您的购物车里！");
					} else if(data == -2) {
						alert("库存里没有这么多商品！");
					} else {
						alert("添加失败，请确认您是否已登陆！");
					}
				});
			}
		}
	-->	
</script>		
                <ul class="books_wrap">
                	<li class="books_wrap_li">
                    	<ul class="pro_list_padding pro_list_padding1">
						
						<?php if($result['data']){foreach($result['data'] as $v){?>
                            <li>
                                <div class="prot_img">
                                    <span class="newprot">新品上市</span>
                                    <a href="<?php echo $this->_url('shop/productshow/'.$v['id']);?>"><img src="<?php echo  $v['is_set_image'] ? str_replace('thumb_','',$v['goods_thumb']) : 'skin/default/images/nopic.gif';?>" alt=""  width="160px" height="120px"  /></a>
                                </div>
                                <div class="title"><a href="<?php echo $this->_url('shop/productshow/'.$v['id']);?>"><?php echo  $v['goods_name'];?></a></div>
                                <div class="attribute"><span>零售价：</span><span>￥<?php echo  $v['goods_refer_price'];?></span></div>
					<?php if (empty($shop_customer)) { ?>
                    <div class="attribute"><span>爱搜价：</span><span><?php if (isset($this->controller->my->id)) { ?>￥<?php echo  $v['goods_price'];?><?php }else{ ?>会员可见<?php } ?></span></div>
					<?php } else { ?>
                    <div class="attribute vip"><span><img src="<?php echo $this->_webroot('images/vip1.jpg'); ?>" />：</span><span class="vipPrice1">￥<?php echo  (($v['goods_price'] * $shop_customer['rebate'])/10) ;?></span></div>
					<?php } ?>
                                <div class="attribute"><span>库存：</span><span><?php echo  $v['goods_number'];?>件</span></div>
                                <div class="attribute attribute1">
                                    <span>数量：</span><a class="cutOrder" href="#"><img src="<?php echo $this->_webroot('images/cutNum.jpg'); ?>" /></a><input type="text" class="orderNum" id="num<?php echo $v['id'] ;?>" name="num<?php echo $v['id'] ;?>" value="1" /><a class="addOrder" href="#"><img src="<?php echo $this->_webroot('images/addNum.jpg'); ?>" /></a>
                                </div>
                                <input type="button" class="orderBtn" value=""   onclick="javascript:addCart(<?php echo $v['id'] ;?>);"/>
                            </li>
						<?php } }?>	
						
                            <div class="clear"></div>  
             			</ul>
						<form  method="get" action="<?php echo $this->_url('shop/products/'.$SHOP['id'].'/?cat='.$value['id'].'&k='.$k);?>">
                        <div class="page-box margintop6">
                            <a href="<?php echo $result['page']['prevPage'];?>" class="pre">上一页</a>
                            <span class="on"><?php echo $result['page']['current']['num'];?></span>	
                            <?php foreach($result['page']['plist'] as $k => $v ) { ?>							
                            <a href="<?php echo $v; ?>"><?php echo $k; ?></a>
							<?php } ?>
                            <a href="<?php echo $result['page']['nextPage'];?>" class="next">下一页</a>
                            <span>共<?php echo $result['page']['pageCount'];?>页</span>
							
                            <span>到<input type="text" class="go-page" name="page" />页</span>
							<?php foreach ( $_GET as $key => $value) { if($key=="page") continue ; ?>
							<input type="hidden"  name="<?php echo $key ; ?>" value="<?php echo $value; ?>"/>	
                            <?php } ?>								
							<input type="submit" class="go-page-btn" value="跳&nbsp;转" />							
                         </div>
						 </form>
                    </li>
                </ul>
                <div class="clear"></div>
            </div>
        	                    
    	</div>
		<!-- 所有商品 end -->
    </div>
    <!-- main_right end -->

	<div class="clear"></div>
</div>

<!-- 友情链接 -->
<psp:tags     htmlname='links'  iconname='links' />
<!-- 友情链接 end -->

<div class="clear"></div>

<psp:tags     htmlname='default_footer'  iconname='defaultfooter' />
</body>
</html>